package com.blex.misp.entity;


import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;


/**
 * Producttype generated by hbm2java
 * @author blex
 */
@Entity
@Table(name = "PRODUCTTYPE")
@DynamicInsert(true)
@DynamicUpdate(true)
public class ProductType {

	private int id;
	private String producttypename;
	private String description;
	private Set<Product> products = new HashSet<Product>(0);


	@Id
	@Column(name = "ID", unique = true, nullable = false, length = 11)
	@GeneratedValue(generator = "generator")
	@GenericGenerator(name = "generator", strategy = "identity")
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Column(name = "PRODUCTTYPENAME", nullable = false, length = 36)
	public String getProducttypename() {
		return this.producttypename;
	}

	public void setProducttypename(String producttypename) {
		this.producttypename = producttypename;
	}

	@Column(name = "DESCRIPTION", length = 100)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	
	@Transient
	@OneToMany(cascade = CascadeType.ALL,fetch = FetchType.LAZY, mappedBy = "producttype")
	public Set<Product> getProducts() {
		return this.products;
	}

	public void setProducts(Set<Product> products) {
		this.products = products;
	}

}
